﻿package  view.monsters{
	import flash.display.MovieClip;
	[Embed(source="../../../lib/TimeSaver.swf", symbol="classes.Life")]
	public class Life extends MovieClip{

		private var maxLife:int;
		private var curLife:int;
		
		public function Life() {
			// constructor code
			//maxLife = 80;
			//curLife = 80;
			this.stop();
			gotoAndStop(1);
		}
		
		public function setMaxLife(life:int):void{
			maxLife = life;
		}
		
		 public function setCurLife(life:int):void{
			curLife = life; 
			var rate:Number = curLife / maxLife;
			var frame:int = int(this.totalFrames* (1 - rate));
			this.gotoAndStop(frame);
		}
		
		public function getCurLife():int{
			return curLife;
		}
		
		public function getMatLife():int {
			return maxLife;
		}
	}
	
}
